class Solution {
    public String reverseWords(String s) {
        String[] str = s.split(" ");
        List<String> list = new ArrayList<>();
        for(int i=0; i<str.length; i++){
            if(!"".equals(str[i])) list.add(str[i]);
        }
        Collections.reverse(list);
        return String.join(" ", list);
    }
}